<?php

namespace App\Master\GET;

class Index extends \App\Master\Common {

    public function index() {
        if (!empty($_GET['type'])) {
            $currentType = \Model\Content::findContent('type', $_GET['type'], 'type_id');
            if (empty($currentType)) {
                $this->error('不存在的类型');
            }
            $this->assign('currentType', $currentType);
            $this->assign('title', $currentType['type_name']);
        }

        $tmList = \Model\Timelog::tmList();
        $this->assign('list', $tmList['list']);
        $this->assign('page', $tmList['page']);

        $type = \Model\Content::listContent([
            'table' => 'type'
        ]);

        $this->assign('type', $type);
        $this->layout();
    }

    public function verify() {
        $verify = new \Expand\Verify();
        $verify->createVerify();
    }

    /**
     * 404页面
     */
    public function _404() {
        header('HTTP/1.1 404');
        $this->assign('title', '404. Not Found');
        $this->display('404');
    }

}
